//
//  UIImageView+Extension.swift
//  CFZWeiBo
//
//  Created by Cedric Zheng on 26/11/2016.
//  Copyright © 2016 Cedric Zheng. All rights reserved.
//

import UIKit
import SDWebImage

extension UIImageView {
    
    convenience init(imageName: String) {
        self.init()
        self.image = UIImage(named: imageName)
    }
    
}

extension UIImageView {
    
    func wb_setImage(withURLString urlStr: String, placeHolder: UIImage?) {
        if let url = URL(string: urlStr) {
            (placeHolder != nil) ?
            sd_setImage(with: url, placeholderImage: placeHolder):
            sd_setImage(with: url)
        }
    }
    
}
